#ifndef EQUIPNODE_H
#define EQUIPNODE_H

#include <iostream>
#include <string>
#include <osgEarth/EarthManipulator>


class EquipNode
{
public:
    EquipNode(const std::string& fName);


    bool IsLoaded()     { return bLoaded; }
    osg::Group* get()   { return veh.get(); }
    void setPosition(const osg::Vec3 pos);
    void setRotoate(const osg::Vec3 rot);
    void setColor(const osg::Vec4 rgba);


private:
    osg::ref_ptr<osg::CoordinateSystemNode> csn;
    osg::ref_ptr<osg::MatrixTransform> position;
    osg::ref_ptr<osg::MatrixTransform> rotate;
    osg::ref_ptr<osg::Node> equip;
    osg::ref_ptr<osg::Group> veh;

    bool bLoaded;
    osg::Vec3 pos_;
    osg::Vec3 rot_;
    osg::Vec3 clr_;
    float     capacity_;
    std::string name_;

public:
    std::string&    name() { return name_; }
    osg::Vec3 pos() { return pos_; }
    void pos(float* p) { p[0] = pos_.x(); p[1] = pos_.y(), p[2] = pos_.z(); }
    osg::Vec3 rot() { return rot_; }
    void rot(float* p) { p[0] = rot_.x()*180.0/osg::PI; p[1] = rot_.y()*180.0/osg::PI, p[2] = rot_.z()*180.0/osg::PI; }
    osg::Vec3 clr() { return clr_; }
    void clr(float* p) { p[0] = clr_.x(); p[1] = clr_.y(), p[2] = clr_.z(); }
    float     capacity() { return capacity_; }
};

#endif // EQUIPNODE_H
